package com.android.jtpay.u3ddemo;

import java.util.Hashtable;
import java.util.Map;

/**
 * Created by Joe on 2017/3/20 0020 15:10.
 */

public class StringToHashmap {
    public static Map<String, String> toHashMap(String target){
        Map<String, String> map=new Hashtable<>();
        String stemp=""; String Key=""; String Value="";int j=0;
        for(char temp:target.toCharArray())
        {
            j++;
            if(temp=='='){
                stemp=stemp.trim();
                Key=stemp;
                stemp="";
            }else if(temp=='|'||temp=='｜'){
                stemp=stemp.trim();
                Value=stemp;
                stemp="";
                map.put(Key,Value);
            }else if(j==target.length() && temp!='|' && temp!='｜'){
                stemp+=temp;
                stemp=stemp.trim();
                Value=stemp;
                map.put(Key,Value);
                break;
            }else{
                stemp+=temp;
            }
        }
        return map;
    }
}
